home *** CD-ROM | disk | FTP | other *** search
/ Archive Magazine CD 1995 / Archive Magazine CD 1995.iso / discs / shareware / share_37 / interface / demo / h / Interface
Encoding:
Text File  |  1990-11-07  |  6.4 KB  |  304 lines

  1. /*
  2.  *
  3.  *       Title                  : ADFS::$.h.interface
  4.  *       System                 : Risc-OS library
  5.  *       Version                : 1.25
  6.  *       Copyright              : © Software Interrupt
  7.  *       Date                   : 25nd September, 1990
  8.  *       Author                 : Simon Huntington
  9.  *
  10.  *       Function               : Headers for Interface functions
  11.  *
  12.  */
  13.  
  14. #include "wimpt.h"
  15. #include "wimp.h"
  16. #include "os.h"
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23. /* 
  24.  *============================================================================
  25.  *
  26.  * Hash defines the swi numbers
  27.  * 
  28.  *============================================================================
  29.  */
  30.  
  31. #define  wimp_borderi             0x81680
  32. #define  wimp_borderw             0x81681
  33. #define  wimp_claim               0x81682
  34. #define  wimp_release             0x81683
  35. #define  wimp_setworkpointer      0x81684
  36. #define  wimp_relworkpointer      0x81685
  37. #define  wimp_pollpoint           0x81686
  38. #define  wimp_help                0x81687
  39.  
  40.  
  41.  
  42.  
  43.  
  44. /* 
  45.  *============================================================================
  46.  *
  47.  * Define the structure for a pointer
  48.  * 
  49.  *============================================================================
  50.  */
  51.  
  52. typedef struct
  53. {
  54.      int   window_handle,
  55.            x0,
  56.            y0,
  57.            x1,
  58.            y1;                  
  59.      char  ptr_validation [24];
  60. } wimp_pointer;
  61.  
  62.  
  63.  
  64.  
  65.  
  66. /* 
  67.  *============================================================================
  68.  *
  69.  * Function to border an icon
  70.  *
  71.  *    Parameters :     mouse - mouse string containg icon, window, buttons
  72.  *
  73.  *    Returns :        An error is not successful
  74.  *  
  75.  *============================================================================
  76.  */
  77.  
  78. os_error *wimp_bordericon (mouse)
  79.      
  80.      wimp_mousestr mouse;
  81.           
  82.      {
  83.           os_regset regs;
  84.           os_error  *error;
  85.  
  86.           regs.r[1] = (int) &mouse;
  87.           error = os_swix (wimp_borderi, ®s);
  88.  
  89.           return error;
  90.      }
  91.  
  92.  
  93.  
  94.  
  95.  
  96. /* 
  97.  *============================================================================
  98.  *
  99.  * Function to border a window
  100.  *
  101.  *    Parameters :     redraw_box - a redraw box as returned from wimp_EREDRAW
  102.  *                                  poll code
  103.  *
  104.  *    Returns :        An error is not successful
  105.  *  
  106.  *============================================================================
  107.  */
  108.  
  109. os_error *wimp_borderwindow (redraw_box)
  110.      
  111.      wimp_redrawstr redraw_box;
  112.           
  113.      {
  114.           os_regset regs;
  115.           os_error  *error;
  116.  
  117.  
  118.           regs.r[1] = (int) &redraw_box;
  119.           error = os_swix (wimp_borderw, ®s);
  120.  
  121.           return error;
  122.      }
  123.  
  124.  
  125.  
  126.  
  127.  
  128. /* 
  129.  *============================================================================
  130.  *
  131.  * Function to allow application to use Interface pointers
  132.  *
  133.  *    Parameters :     None
  134.  *
  135.  *    Returns :        An error is not successful
  136.  *  
  137.  *============================================================================
  138.  */
  139.  
  140. os_error *wimp_claiminterface (void)              
  141.      {
  142.           os_regset regs;
  143.           os_error  *error;
  144.  
  145.           regs.r[0] = (int) wimpt_task ();
  146.           error = os_swix (wimp_claim, ®s);
  147.  
  148.           return error;
  149.      }
  150.  
  151.  
  152.  
  153.  
  154.  
  155. /* 
  156.  *============================================================================
  157.  *
  158.  * Function to stop the application using pointers and remove any workspace
  159.  * used by the application
  160.  *
  161.  *    Parameters :     None
  162.  *
  163.  *    Returns :        An error is not successful
  164.  *  
  165.  *============================================================================
  166.  */
  167.  
  168. os_error *wimp_releaseinterface (void)              
  169.      {
  170.           os_regset regs;
  171.           os_error  *error;
  172.  
  173.           regs.r[0] = (int) wimpt_task ();
  174.           error = os_swix (wimp_release, ®s);
  175.  
  176.           return error;
  177.      }
  178.  
  179.  
  180.  
  181.  
  182.  
  183. /* 
  184.  *============================================================================
  185.  *
  186.  * Function to set a workarea pointer
  187.  *
  188.  *    Parameters :     pointer - a pointer block as described at the start
  189.  *                               of this header
  190.  *
  191.  *    Returns :        An error is not successful
  192.  *  
  193.  *============================================================================
  194.  */
  195.  
  196. os_error *wimp_setworkareapointer (pointer)
  197.      
  198.      wimp_pointer pointer;
  199.           
  200.      {
  201.           os_regset regs;
  202.           os_error  *error;
  203.  
  204.           regs.r[1] = (int) &pointer;
  205.           error = os_swix (wimp_setworkpointer, ®s);
  206.  
  207.           return error;
  208.      }
  209.  
  210.  
  211.  
  212.  
  213.  
  214. /* 
  215.  *============================================================================
  216.  *
  217.  * Function to release a workarea pointer
  218.  *
  219.  *    Parameters :     pointer - a pointer block as described at the start
  220.  *                               of this header
  221.  *
  222.  *    Returns :        An error is not successful
  223.  *  
  224.  *============================================================================
  225.  */
  226.  
  227. os_error *wimp_releaseworkareapointer (pointer)
  228.      
  229.      wimp_pointer pointer;
  230.           
  231.      {
  232.           os_regset regs;
  233.           os_error  *error;
  234.  
  235.           regs.r[0] = (int) wimpt_task ();
  236.           regs.r[1] = (int) &pointer;
  237.           error = os_swix (wimp_relworkpointer, ®s);
  238.  
  239.           return error;
  240.      }                              
  241.  
  242.  
  243.  
  244.  
  245.  
  246. /* 
  247.  *============================================================================
  248.  *
  249.  * Function to swap pointers when over an icon or the appropriate workarea
  250.  *
  251.  *    Parameters :     poll - the wimp poll reason code
  252.  *
  253.  *    Returns :        An error is not successful
  254.  *  
  255.  *============================================================================
  256.  */
  257.  
  258. os_error *wimp_pollpointer (poll)
  259.      
  260.      int poll;
  261.           
  262.      {
  263.           os_regset regs;
  264.           os_error  *error;
  265.  
  266.           regs.r[0] = (int) poll;
  267.           regs.r[2] = (int) wimpt_task ();
  268.           error = os_swix (wimp_pollpoint, ®s);
  269.  
  270.           return error;
  271.      }
  272.  
  273.  
  274.  
  275.  
  276.  
  277. /* 
  278.  *============================================================================
  279.  *
  280.  * Function to send help to the help application
  281.  *
  282.  *    Parameters :     message_block - the message block from the help 
  283.  *                                     application
  284.  *
  285.  *    Returns :        An error is not successful
  286.  *  
  287.  *============================================================================
  288.  */
  289.  
  290. os_error *wimp_sendhelp (message_block) 
  291.  
  292.      wimp_msghdr *message_block;
  293.  
  294.      {
  295.           os_regset regs;
  296.           os_error  *error;
  297.           
  298.           regs.r[1] = (int) message_block;
  299.           error = os_swix (wimp_help, ®s);
  300.  
  301.           return error;
  302.      }
  303.  
  304.